/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-06-02
 * Time: 17:58
 */
class MyArray<E> {
    public Object[] objects = new Object[10];
    public void setValue(int pos,E a) {
        objects[pos] = a;
    }
    public E getValue(int pos) {
        return (E) objects[pos];
    }
}
public class Test {
    public static void main(String[] args) {
        MyArray<Integer> myArray = new MyArray<Integer>();
        myArray.setValue(0,23);
        myArray.setValue(1,33);
        myArray.setValue(2,43);
        for (int i = 0; i < 3; i++) {
            System.out.println(myArray.getValue(i));
        }
        MyArray<String> myArray1 = new MyArray<>();
        myArray1.setValue(0,"hello");
        myArray1.setValue(1,"wow");
        myArray1.setValue(2,"world");
        for (int i = 0; i < 3; i++) {
            System.out.println(myArray1.getValue(i));
        }

    }
}
